package com.twu.biblioteca.movie;

import com.twu.biblioteca.movie.Movie;
import com.twu.biblioteca.util.IO;

import java.util.HashMap;

public class PrintMovie {

    public String format() {
        return "Movie\tYear\tDirector\tRating";
    }

    public String format(Movie movie) {
        return movie.getName() + "\t" + movie.getYear() + "\t" + movie.getDirector() + "\t" + movie.getOutPutRating();
    }

    public void print(MovieManager movieManager) {
        HashMap<Movie, Integer> movies = movieManager.getMovies();
        IO.write(format());
        for (Movie movie : movies.keySet()) {
            IO.write(format(movie));
        }
    }
}
